//x+y+z=120
//x*x+y*y=(p-x-y)*(p-x-y)
//p*p+ 2xy-2p(x+y) = 0
//p*p+ 2xy-2px-2py =0
//p*p - 2py = (2p-2y)*x

var max_count=0;
for(var p=120; p<=1000;p++) {
    var pp = p*p;
    var count = 0;
    for(var y=1; y<p; y++) {
        var x = (pp - 2*p*y)/(2*p-2*y);
        if(x%1==0 && x>0) {
            //print("p=" + p + ",x=" + x + ",y=" +y);
            count++;
        }
    }
    if(count>max_count) {
        max_count=count;
        print("p=" + p + ", count=" + count);
    }
}

print(max_count);

